import EscookButton from '@/components/05.自定义插件/01.EscookButton.vue'
import vLazy from '@/directives/v-lazy.js'
import toast from './toast.js'
import { ref } from 'vue'

export default {
  install(app, options) {
    // 注册全局组件
    app.component('EscookButton', EscookButton)
    // 注册全局指令
    app.directive('lazy', vLazy)

    // 全局注入数据
    app.provide('$global', ref(options?.globalData || {}))

    // 使用 app.config.globalProperties 向全局挂载数据
    app.config.globalProperties.$msg = 'Hello liulongbin.'
    app.config.globalProperties.$toast = toast
  }
}
